#
#  Clouds.py
#  TurnShip
#
#  Created by Pete Lord on 12/02/2009.
#  Copyright (c) 2009 __MyCompanyName__. All rights reserved.
#
import pygame, Options, Objects, os

class Cloud(Objects.Object):
    def __init__(self, parent, x, y, colour):
        Objects.Object.__init__(self,x, y, 0)
        self.parent = parent
        self.colour = colour
        self.graphic = pygame.image.load(os.path.join('Data', 'Nothing.png')) # main thing.
        self.pencil = pygame.Surface((1,1))
        self.pencil.fill(self.colour)

        self.cross = pygame.image.load(os.path.join('Data', 'Nothing.png'))
        pygame.transform.scale(self.cross, (3,3))
        self.pencil.set_alpha(255)
        self.cross.blit(self.pencil, (1, 1))
        self.pencil.set_alpha(150)
        self.cross.blit(self.pencil, (1, 0))
        self.cross.blit(self.pencil, (1, 2))
        self.cross.blit(self.pencil, (0, 1))
        self.cross.blit(self.pencil, (2, 1))
                
        self.graphic.convert_alpha()
        self.pencil.convert_alpha()
        
    def clear(self):
        self.graphic = pygame.Surface((64,64))
        
    def set_alpha(self, x, y, value):
        self.pencil.set_alpha(value)
        self.graphic.blit(self.pencil, (x, y))
    
    def set_alpha_cross(self, x, y, value):
        # MINIMUM OF x = 1, y = 1, MAXIMUM OF x = 63, y = 63
        self.cross.set_alpha(value)
        self.graphic.blit(self.cross, (x-1 , y-1))
        
    def set_alphas(self, list):
        # pass this a list of tuples with (x, y, value) and it'll do them all. Woo!
        for item in list:
            self.set_alpha(item[0], item[1], item[2])
            
    def set_alphas_cross(self, list):
        # pass this a list of tuples with (x, y, value) and it'll do them all. Woo!
        for item in list:
            self.set_alpha_cross(item[0] -1 , item[1] -1, item[2])